package TradeApp.IB;

import org.aspectj.lang.Signature;
import org.aspectj.lang.reflect.SourceLocation;

import Esper.CEPMan;
import TradeApp.IB.Esper.Adapters.IBClient;

import com.ib.client.EClientSocket;

public aspect IBAdapterHelper {
	pointcut isConn(EClientSocket ibSoc): call(* EClientSocket.connectionError(..)) && target(ibSoc);
		
	before(EClientSocket ibSoc) : isConn(ibSoc) {
		synchronized (ibSoc) {
			if (!ibSoc.isConnected()) {
					IBClient.connect();
			}
		}
	}
}
